#include <stdint.h>
#include "hj212_client_config.h"


#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
void hj_dump_hex(const uint8_t *ptr, int buflen, int witdh)
{
#ifdef HJ_LOG_OUTPUT
    unsigned char *buf = (unsigned char *)ptr;
    int i, j;
    for (i = 0; i < buflen; i += witdh)
    {
        HJ_LOG_OUTPUT("%06x: ", i);
        for (j = 0; j < witdh; j++)
            if (i + j < buflen)
                HJ_LOG_OUTPUT("%02x ", buf[i + j]);
            else
                HJ_LOG_OUTPUT("   ");
        HJ_LOG_OUTPUT(" ");
        for (j = 0; j < witdh; j++)
            if (i + j < buflen)
                HJ_LOG_OUTPUT("%c", __is_print(buf[i + j]) ? buf[i + j] : '.');
        HJ_LOG_OUTPUT("\n");
    }
#else
    ptr = ptr;
    buflen = buflen;
    witdh = witdh;
#endif
}

